const express = require("express");
const app = express();
const path = require("path");
const cors = require("cors");
const url = require("url");
const qs = require("querystring");
//发送一个html文件给到浏览器
//http://localhost:3000

//3. proxy(Vue)
app.get("/d", (req, res) => {
    res.sendFile(path.resolve("./public/index.html"));
});
//负责跟浏览器沟通
app.get("/s", (req, res) => {
    var { wd } = qs.parse(url.parse(req.url).query);
    res.send(`${wd}("这是服务器发送的内容")`);
    //res.sendFile(path.resolve("./public/1.js"));
});

app.listen(3000);

//npm i cors
//npm i express